home *** CD-ROM | disk | FTP | other *** search
- #! /usr/dt/bin/dtksh
- #
- # CallbackTest2
- #
- # Copyright 2000, Silicon Graphics, Inc.
- # ALL RIGHTS RESERVED
- #
- # UNPUBLISHED -- Rights reserved under the copyright laws of the United
- # States. Use of a copyright notice is precautionary only and does not
- # imply publication or disclosure.
- #
- # U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
- # Use, duplication or disclosure by the Government is subject to restrictions
- # as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
- # in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
- # in similar or successor clauses in the FAR, or the DOD or NASA FAR
- # Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
- # 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
- #
- # THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
- # INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
- # DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
- # PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
- # GRAPHICS, INC.
- #
-
- ##########################################################################
- # (c) Copyright 1993, 1994 Hewlett-Packard Company
- # (c) Copyright 1993, 1994 International Business Machines Corp.
- # (c) Copyright 1993, 1994 Sun Microsystems, Inc.
- # (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
- # Novell, Inc.
- ##########################################################################
-
-
- #
- # This sample shell script demonstrates how widget callbacks can be
- # added and removed. It adds callbacks both using XtAddCallback and
- # by specifying a callback as a resource, when the test pushbutton
- # is created.
- #
-
- # The activate callback which can be dynamically added and removed
- ActivateCallback1()
- {
- echo "activateCallback1 invoked"
- }
-
- # The activate callback which is added when the widget was created
- ActivateCallback2()
- {
- echo "activateCallback2 invoked"
- }
-
- # Pushbutton Callback: Adds an activate callback to the test pushbutton
- AddCallback1()
- {
- XtAddCallback $TESTPB activateCallback ActivateCallback1
- XtGetValues $TESTPB activateCallback:AC
- echo "Callback list = "$AC
- }
-
- # Pushbutton Callback: Removes an activate callback from the test pushbutton
- DeleteCallback1()
- {
- XtRemoveCallback $TESTPB activateCallback ActivateCallback1
- XtGetValues $TESTPB activateCallback:AC2
- echo "Callback list = "$AC2
- }
-
- ######################### Create the Main UI #################################
-
- XtInitialize TOPLEVEL callbackTest CallbackTest "$0" "$@"
-
- XtCreateManagedWidget FORM form XmForm $TOPLEVEL
-
- XtCreateManagedWidget PB1 pb XmPushButton $FORM \
- labelString:"Add Callback1" \
- topAttachment:ATTACH_FORM \
- topOffset:10 \
- leftAttachment:ATTACH_POSITION \
- leftPosition:10 \
- rightAttachment:ATTACH_POSITION \
- rightPosition:40 \
- activateCallback:AddCallback1
-
- XtCreateManagedWidget PB2 pb2 XmPushButton $FORM \
- labelString:"Delete Callback1" \
- topAttachment:ATTACH_FORM \
- topOffset:10 \
- leftAttachment:ATTACH_POSITION \
- leftPosition:60 \
- rightAttachment:ATTACH_POSITION \
- rightPosition:90 \
- activateCallback:DeleteCallback1
-
- XtCreateManagedWidget TESTPB testpb XmPushButton $FORM \
- labelString:"Test Button" \
- topAttachment:ATTACH_WIDGET \
- topWidget:$PB2 \
- topOffset:20 \
- leftAttachment:ATTACH_POSITION \
- leftPosition:20 \
- rightAttachment:ATTACH_POSITION \
- rightPosition:80 \
- bottomAttachment:ATTACH_FORM \
- bottomOffset:10 \
- activateCallback:ActivateCallback2
-
- XtRealizeWidget $TOPLEVEL
-
- XtMainLoop
-